﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentNHibernate.Mapping;

namespace mscook.core.domain
{
    public class LoginUserMap : ClassMap<LoginUser>
    {
        public LoginUserMap()
        {
            Id(o => o.Id);
            Map(o => o.CreateTime);
            Map(o => o.IsDelete);
            Map(o => o.Version);
            Map(o => o.EntityIndex);
            Map(o => o.LastLogin);
            Map(o => o.LoginName);
            Map(o => o.Password);
            Map(o => o.Name);
            Map(o => o.IsAnonymous);
            Map(o => o.Tel);
            Map(o => o.Description).CustomType("StringClob").CustomSqlType("nvarchar(max)");
            Map(o => o.Email);
            Map(o => o.VipInvalidDate);
            Map(o => o.Bonus);
            Map(o=>o.Address);
            Map(o=>o.SelfPage);
            Map(o=>o.TodayBonus);
         
            Map(o => o.UserRole).Not.Nullable();
            HasMany<PurchasedThing>(o => o.PurchasedThings).KeyColumn("LoginUserId").Cascade.SaveUpdate();
            //References<BonusCondition>(o => o.BonusCondition).Cascade.All();
            //References<BonusCondition>(o => o.BonusCondition).Cascade.All();//2013-12-11 HasOne并不会映射到数据库，仅仅表示关系并代理
        }
    }
}
